/********************************************************************************
 *      Copyright:  (C) 2022 Li Yanting<liyanting2@163.com>
 *                  All rights reserved.
 *
 *       Filename:  client_sqlite.h
 *    Description:  This head file 
 *
 *        Version:  1.0.0(04/19/2022)
 *         Author:  Li Yanting <liyanting2@163.com>
 *      ChangeLog:  1, Release initial version on "04/19/2022 12:48:06 PM"
 *                 
 ********************************************************************************/

#ifndef _CLIENT_SQLITE_H_
#define _CLIENT_SQLITE_H_

#include <sqlite3.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "logger.h"

#define CONFIG_DEBUG
#ifdef CONFIG_DEBUG
#define dbg_printf(format, args...) printf(format, ##args)
#else
#define dbg_printf(format, args...) do{} while(0)
#endif

int create_statement(sqlite3 *db, char *statement_name);
int open_database(sqlite3 **db);
int sql_delete(sqlite3 *db, char *statement_name);
int sql_insert(sqlite3 *db, char *statement_name, char *format_time, float temper);
int sql_check(sqlite3 *db, char *statement_name);
int sql_write_to_server(sqlite3 *db, int sockfd, char *statement_name);


static int callback_check(void *data, int argc, char **argv, char **azColName);
static int callback_write(void *data, int argc, char **argv, char **azColName);


#endif

